const baseCardIcon = require('../assets/base_card_icon.png')
const baseCardBgImage = require('../assets/base_card_bg.png')
const baseCardName = window.buscardName || ''
const baseCardBgColor = window.APP_THEME_COLOR || '#28acff'

/*
 * @Description: 卡面信息模型
 * @Author: yingying.fan
 * @Date: 2019-03-21 10:22:00
 * @Last Modified by: yingying.fan
 * @Last Modified time: 2019-04-01 20:34:52
 */
export default class CardInfoModel {
  /**
   *
   * @param {String} icon 卡图标
   * @param {String} name 卡名称
   * @param {String} bgColor 卡背景色
   * @param {String} bgImage 卡背景图
   * @param {Number} amount 卡余额
   */
  constructor(data = {}) {
    // icon = baseCardIcon,
    // name = baseCardName,
    // bgColor = baseCardBgColor,
    // bgImage = baseCardBgImage,
    // balance = 0
    this.icon = data.ICON || baseCardIcon
    this.name = data.CARD_NAME || baseCardName
    this.bgColor = data.BACKGROUND_COLOR || baseCardBgColor
    this.bgImage = data.BACKGROUND_IMAGE || baseCardBgImage
    this.cardInstanceId = data.CARD_INSTANCE_ID
    this.cardType = data.CARD_TYPE
    this.userName = data.CARD_OWNER || ''
    this.amount = data.AMOUNT || 0
    this.cardNo = data.CARD_NO || ''
    this.showCardNo = data.SHOW_CARD_NO || ''
    this.state = data.STATE || 0
    this.descGo = data.DESC_GOTO || ''
  }

  setBalance(amount = 0) {
    this.balance = amount
  }
}
